package com.geline.mybatisplus.domain;

/**
 * @author: mengxin
 * @date: 2023/9/23 20:05
 */
public class SqlConditions {
    public static final String EQUAL = "%s=#{%s}";
    public static final String NOT_EQUAL = "%s&lt;&gt;#{%s}";
    public static final String LIKE = "%s LIKE CONCAT('%%',#{%s},'%%')";
    public static final String ORACLE_LIKE = "%s LIKE CONCAT(CONCAT('%%',#{%s}),'%%')";
    public static final String LIKE_LEFT = "%s LIKE CONCAT('%%',#{%s})";
    public static final String LIKE_RIGHT = "%s LIKE CONCAT(#{%s},'%%')";

    /**
     * 日期条件：等于日期：AND date_format(create_time, '%Y-%m-%d') = date_format(#{cm.createTime}, '%Y-%m-%d')
     * 日期条件：等于日期：AND create_time = #{cm.createTime}
     */
    public static final String DATE_EQ = "%s = #{%s}";

    /**
     * 日期条件：大于等于开始日期：AND date_format(create_time, '%Y-%m-%d') >= date_format(#{cm.createTime}, '%Y-%m-%d')
     * 日期条件：大于等于开始日期：AND create_time >= #{cm.createTime}
     */
    public static final String DATE_GT = "%s >= #{%s}";

    /**
     * 日期条件：小于等于结束日期：AND date_format(create_time, '%Y-%m-%d') <= date_format(#{cm.createTime}, '%Y-%m-%d')
     * 日期条件：小于等于结束日期：AND create_time <= #{cm.createTime}
     */
    public static final String DATE_LT = "%s <= #{%s}";

    /**
     * AND user_id in (#{idList})
     */
    public static final String IN = "%s in (#{%s})";

    /**
     * AND user_id not in (#{idList})
     */
    public static final String NOT_IN = "%s not in (#{%s})";

    /**
     * AND date_format(create_time,'%Y-%m-%d') between #{%s} and #{%s}
     */
    public static final String BETWEEN_AND = "date_format(%s,'%Y-%m-%d') between #{%s} and #{%s}";
}
